﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace zielonka.co.uk.system.text.regularExpressions
{
    // Description:	Check wheter a string is an valid e-mail address
    /*
     * bool f = "test@test.com".IsValidEmailAddress();
     */
    public static partial class StringExtensions
    {
        public static bool IsValidEmailAddress(this string s)
        {
            Regex regex = new Regex(@"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$");
            return regex.IsMatch(s);
        }
    }
}
